<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateShopLicenseResourceRecords extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cruise_shop_license_resource_records', function (Blueprint $table) {
            $table->id();

            $table->unsignedInteger('shopId')->default(0)->comment('门店ID');

            $table->tinyInteger('type')->default(0)->comment('类型:1-营业执照,2-食品许可证');
            $table->tinyInteger('status')->default(0)->comment('状态:1-待审核,2-审核通过,3-已驳回,4-已过期');
            $table->string('url', 128)->default('')->comment('公开OSS库文件路径');
            $table->string('name', 64)->default('')->comment('执照名称');
            $table->string('licenceNumber', 50)->default('')->comment('经营者名称');
            $table->string('legalPerson', 32)->default('')->comment('法人');

            $table->unsignedBigInteger('licenseStartDate')->default(0)->comment('有效期开始');
            $table->unsignedBigInteger('licenseEndDate')->default(0)->comment('有效期结束');

            $table->json('contents')->nullable()->comment('资质字段');

            $table->unsignedInteger('cruiseAt')->default(0)->comment('稽核时间');
            $table->unsignedInteger('cruiseAtByUid')->default(0)->comment('稽核人员');
            $table->string('causeOfRejection', 255)->default('')->comment('驳回原因');
            $table->string('remark', 255)->default('')->comment('驳回原因备注');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->tinyInteger("isDeleted")->default(0)->comment("是否删除,0:未删除,1:已删除");
            $table->index('shopId', 'idx_shopId');

            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '门店资质素材审核表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('shop_license_resource_records');
    }
}
